From 01bcda8a8c5c2e7a87db1a1b585fc858abb9657e Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 15 Feb 2016 06:50:49 +0100 Subject: [PATCH] win32 theme: Query theme borders when rendering buttons If someone figures out where the remaining pixel comes from: Tell me! --- gtk/theme/win32/gtk-win32-base.css | 41 +++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/gtk/theme/win32/gtk-win32-base.css b/gtk/theme/win32/gtk-win32-base.css index 6e00067cfc..ae68ea1857 100644 --- a/gtk/theme/win32/gtk-win32-base.css +++ b/gtk/theme/win32/gtk-win32-base.css @@ -286,33 +286,44 @@ radio:indeterminate:disabled { /* Buttons */ button { - background-color: transparent; background-image: -gtk-win32-theme-part(button, 1, 1); - border-width: 0; - padding: 3px; -} - -button:disabled { - background-image: -gtk-win32-theme-part(button, 1, 4); + padding-top: calc(1px + -gtk-win32-part-border-top(button, 1, 1)); + padding-right: calc(1px + -gtk-win32-part-border-right(button, 1, 1)); + padding-bottom: calc(1px + -gtk-win32-part-border-bottom(button, 1, 1)); + padding-left: calc(1px + -gtk-win32-part-border-left(button, 1, 1)); } -button:focus { +button.default { background-image: -gtk-win32-theme-part(button, 1, 5); + padding-top: calc(1px + -gtk-win32-part-border-top(button, 1, 5)); + padding-right: calc(1px + -gtk-win32-part-border-right(button, 1, 5)); + padding-bottom: calc(1px + -gtk-win32-part-border-bottom(button, 1, 5)); + padding-left: calc(1px + -gtk-win32-part-border-left(button, 1, 5)); } -button:hover, button:hover:focus { +button:hover { background-image: -gtk-win32-theme-part(button, 1, 2); - color: @text_color; + padding-top: calc(1px + -gtk-win32-part-border-top(button, 1, 2)); + padding-right: calc(1px + -gtk-win32-part-border-right(button, 1, 2)); + padding-bottom: calc(1px + -gtk-win32-part-border-bottom(button, 1, 2)); + padding-left: calc(1px + -gtk-win32-part-border-left(button, 1, 2)); } -button:active, button:active:focus, button:active:focus:hover { +button:active, button:checked { background-image: -gtk-win32-theme-part(button, 1, 3); - color: @text_color; + padding-top: calc(1px + -gtk-win32-part-border-top(button, 1, 3)); + padding-right: calc(1px + -gtk-win32-part-border-right(button, 1, 3)); + padding-bottom: calc(1px + -gtk-win32-part-border-bottom(button, 1, 3)); + padding-left: calc(1px + -gtk-win32-part-border-left(button, 1, 3)); } -/* Override *:selected { ...} style; affects horizontalbuttons */ -button:selected { - background-color: transparent; +/* XXX: Figure out how to handle disabled active togglebuttons */ +button:disabled { + background-image: -gtk-win32-theme-part(button, 1, 4); + padding-top: calc(1px + -gtk-win32-part-border-top(button, 1, 4)); + padding-right: calc(1px + -gtk-win32-part-border-right(button, 1, 4)); + padding-bottom: calc(1px + -gtk-win32-part-border-bottom(button, 1, 4)); + padding-left: calc(1px + -gtk-win32-part-border-left(button, 1, 4)); } /* Scrollbars */ -- 2.30.2